<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Docker安装Oracle 12c | 눈_눈？</title>
    <meta name="generator" content="VuePress 1.8.2">
    <link rel="icon" href="/favicon.ico">
    <meta name="description" content="雨润三江水,一任五更寒">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
    
    <link rel="preload" href="/assets/css/0.styles.39493abb.css" as="style"><link rel="preload" href="/assets/js/app.f4a44a18.js" as="script"><link rel="preload" href="/assets/js/3.48232c0c.js" as="script"><link rel="preload" href="/assets/js/1.1ffd113d.js" as="script"><link rel="preload" href="/assets/js/22.f3c7aad6.js" as="script"><link rel="prefetch" href="/assets/js/10.3ca9dec1.js"><link rel="prefetch" href="/assets/js/11.874c1055.js"><link rel="prefetch" href="/assets/js/12.ba64ad86.js"><link rel="prefetch" href="/assets/js/13.567f7e2c.js"><link rel="prefetch" href="/assets/js/14.a883120b.js"><link rel="prefetch" href="/assets/js/15.f0f48289.js"><link rel="prefetch" href="/assets/js/16.665ca6bd.js"><link rel="prefetch" href="/assets/js/17.9e5d8903.js"><link rel="prefetch" href="/assets/js/18.f72895dc.js"><link rel="prefetch" href="/assets/js/19.2a106cc2.js"><link rel="prefetch" href="/assets/js/20.4c0d7dc8.js"><link rel="prefetch" href="/assets/js/21.6771e3a2.js"><link rel="prefetch" href="/assets/js/23.60529100.js"><link rel="prefetch" href="/assets/js/24.7d50cb5e.js"><link rel="prefetch" href="/assets/js/25.58231492.js"><link rel="prefetch" href="/assets/js/26.3067a077.js"><link rel="prefetch" href="/assets/js/27.b167830e.js"><link rel="prefetch" href="/assets/js/28.f5722284.js"><link rel="prefetch" href="/assets/js/29.62d2e4fe.js"><link rel="prefetch" href="/assets/js/30.c2afa3b0.js"><link rel="prefetch" href="/assets/js/31.d7dde24d.js"><link rel="prefetch" href="/assets/js/32.4e2b272d.js"><link rel="prefetch" href="/assets/js/33.5e4d7960.js"><link rel="prefetch" href="/assets/js/34.8d5624e0.js"><link rel="prefetch" href="/assets/js/35.abd48ffb.js"><link rel="prefetch" href="/assets/js/36.e231ea32.js"><link rel="prefetch" href="/assets/js/37.e99c1b8f.js"><link rel="prefetch" href="/assets/js/38.ff825294.js"><link rel="prefetch" href="/assets/js/39.b3321103.js"><link rel="prefetch" href="/assets/js/4.936c6377.js"><link rel="prefetch" href="/assets/js/40.8e915e21.js"><link rel="prefetch" href="/assets/js/41.9a5c6a3d.js"><link rel="prefetch" href="/assets/js/42.2159b3c3.js"><link rel="prefetch" href="/assets/js/43.144bc67d.js"><link rel="prefetch" href="/assets/js/44.c7b1a0a9.js"><link rel="prefetch" href="/assets/js/45.fafbd061.js"><link rel="prefetch" href="/assets/js/46.dfd415c1.js"><link rel="prefetch" href="/assets/js/47.d6285fa6.js"><link rel="prefetch" href="/assets/js/48.c3c90153.js"><link rel="prefetch" href="/assets/js/49.fa7ab119.js"><link rel="prefetch" href="/assets/js/5.0bd232c4.js"><link rel="prefetch" href="/assets/js/50.6d5fe086.js"><link rel="prefetch" href="/assets/js/51.e0b9a5c9.js"><link rel="prefetch" href="/assets/js/52.39d71cb2.js"><link rel="prefetch" href="/assets/js/53.ad47bc0c.js"><link rel="prefetch" href="/assets/js/54.989d4596.js"><link rel="prefetch" href="/assets/js/55.fea0aaad.js"><link rel="prefetch" href="/assets/js/56.af246d88.js"><link rel="prefetch" href="/assets/js/57.747bce1d.js"><link rel="prefetch" href="/assets/js/58.8d177768.js"><link rel="prefetch" href="/assets/js/59.e97890fd.js"><link rel="prefetch" href="/assets/js/6.8aac6fc8.js"><link rel="prefetch" href="/assets/js/60.114e9ca6.js"><link rel="prefetch" href="/assets/js/7.f1ea8070.js"><link rel="prefetch" href="/assets/js/8.af678f34.js"><link rel="prefetch" href="/assets/js/9.a1b28891.js">
    <link rel="stylesheet" href="/assets/css/0.styles.39493abb.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div><div class="theme-container" data-v-e3b9d544><div data-v-e3b9d544><div id="loader-wrapper" class="loading-wrapper" data-v-1c4f0192 data-v-e3b9d544 data-v-e3b9d544><div class="loader-main" data-v-1c4f0192><div data-v-1c4f0192></div><div data-v-1c4f0192></div><div data-v-1c4f0192></div><div data-v-1c4f0192></div></div> <!----> <!----></div> <div class="password-shadow password-wrapper-out" style="display:none;" data-v-071f7da2 data-v-e3b9d544 data-v-e3b9d544><h3 class="title" style="display:none;" data-v-071f7da2 data-v-071f7da2>눈_눈？</h3> <!----> <label id="box" class="inputBox" style="display:none;" data-v-071f7da2 data-v-071f7da2><input type="password" value="" data-v-071f7da2> <span data-v-071f7da2>Konck! Knock!</span> <button data-v-071f7da2>OK</button></label> <div class="footer" style="display:none;" data-v-071f7da2 data-v-071f7da2><span data-v-071f7da2><i class="iconfont reco-theme" data-v-071f7da2></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-071f7da2>vuePress-theme-reco</a></span> <span data-v-071f7da2><i class="iconfont reco-other" data-v-071f7da2></i> <a data-v-071f7da2>yykrlc</a></span> <span data-v-071f7da2><i class="iconfont reco-copyright" data-v-071f7da2></i> <a data-v-071f7da2>2021</a></span></div></div> <div class="hide" data-v-e3b9d544><header class="navbar" data-v-e3b9d544><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><img src="/head.png" alt="눈_눈？" class="logo"> <span class="site-name">눈_눈？</span></a> <div class="links"><div class="color-picker"><a class="color-button"><i class="iconfont reco-color"></i></a> <div class="color-picker-menu" style="display:none;"><div class="mode-options"><h4 class="title">Choose mode</h4> <ul class="color-mode-options"><li class="dark">dark</li><li class="auto active">auto</li><li class="light">light</li></ul></div></div></div> <div class="search-box"><i class="iconfont reco-search"></i> <input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/" class="nav-link"><i class="iconfont reco-home"></i>
  首页
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-category"></i>
      分类
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/categories/朗读/" class="nav-link"><i class="iconfont undefined"></i>
  朗读
</a></li><li class="dropdown-item"><!----> <a href="/categories/工具/" class="nav-link"><i class="iconfont undefined"></i>
  工具
</a></li><li class="dropdown-item"><!----> <a href="/categories/Docker/" class="nav-link"><i class="iconfont undefined"></i>
  Docker
</a></li><li class="dropdown-item"><!----> <a href="/categories/Linux/" class="nav-link"><i class="iconfont undefined"></i>
  Linux
</a></li><li class="dropdown-item"><!----> <a href="/categories/sql/" class="nav-link"><i class="iconfont undefined"></i>
  sql
</a></li><li class="dropdown-item"><!----> <a href="/categories/其他/" class="nav-link"><i class="iconfont undefined"></i>
  其他
</a></li><li class="dropdown-item"><!----> <a href="/categories/Other/" class="nav-link"><i class="iconfont undefined"></i>
  Other
</a></li><li class="dropdown-item"><!----> <a href="/categories/python/" class="nav-link"><i class="iconfont undefined"></i>
  python
</a></li><li class="dropdown-item"><!----> <a href="/categories/Vue/" class="nav-link"><i class="iconfont undefined"></i>
  Vue
</a></li><li class="dropdown-item"><!----> <a href="/categories/Css/" class="nav-link"><i class="iconfont undefined"></i>
  Css
</a></li><li class="dropdown-item"><!----> <a href="/categories/JavaScript/" class="nav-link"><i class="iconfont undefined"></i>
  JavaScript
</a></li><li class="dropdown-item"><!----> <a href="/categories/闲言碎语/" class="nav-link"><i class="iconfont undefined"></i>
  闲言碎语
</a></li></ul></div></div><div class="nav-item"><a href="/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  标签
</a></div><div class="nav-item"><a href="/tools/" class="nav-link"><i class="iconfont reco-document"></i>
  收藏
</a></div><div class="nav-item"><a href="/photo/" class="nav-link"><i class="iconfont reco-douyin"></i>
  画廊
</a></div><div class="nav-item"><a href="/friends/" class="nav-link"><i class="iconfont reco-friend"></i>
  关于
</a></div><div class="nav-item"><a href="/timeLine/" class="nav-link"><i class="iconfont reco-date"></i>
  时间轴
</a></div> <!----></nav></div></header> <div class="sidebar-mask" data-v-e3b9d544></div> <aside class="sidebar" data-v-e3b9d544><div class="personal-info-wrapper" data-v-c115f482><img src="/assets/img/home-head.32578f7e.png" alt="hero" class="personal-img" data-v-c115f482> <h3 class="name" data-v-c115f482>yykrlc</h3> <div class="num" data-v-c115f482><div data-v-c115f482><h3 data-v-c115f482>44</h3> <h6 data-v-c115f482>文章</h6></div> <div data-v-c115f482><h3 data-v-c115f482>27</h3> <h6 data-v-c115f482>标签</h6></div></div> <hr data-v-c115f482></div> <nav class="nav-links"><div class="nav-item"><a href="/" class="nav-link"><i class="iconfont reco-home"></i>
  首页
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-category"></i>
      分类
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/categories/朗读/" class="nav-link"><i class="iconfont undefined"></i>
  朗读
</a></li><li class="dropdown-item"><!----> <a href="/categories/工具/" class="nav-link"><i class="iconfont undefined"></i>
  工具
</a></li><li class="dropdown-item"><!----> <a href="/categories/Docker/" class="nav-link"><i class="iconfont undefined"></i>
  Docker
</a></li><li class="dropdown-item"><!----> <a href="/categories/Linux/" class="nav-link"><i class="iconfont undefined"></i>
  Linux
</a></li><li class="dropdown-item"><!----> <a href="/categories/sql/" class="nav-link"><i class="iconfont undefined"></i>
  sql
</a></li><li class="dropdown-item"><!----> <a href="/categories/其他/" class="nav-link"><i class="iconfont undefined"></i>
  其他
</a></li><li class="dropdown-item"><!----> <a href="/categories/Other/" class="nav-link"><i class="iconfont undefined"></i>
  Other
</a></li><li class="dropdown-item"><!----> <a href="/categories/python/" class="nav-link"><i class="iconfont undefined"></i>
  python
</a></li><li class="dropdown-item"><!----> <a href="/categories/Vue/" class="nav-link"><i class="iconfont undefined"></i>
  Vue
</a></li><li class="dropdown-item"><!----> <a href="/categories/Css/" class="nav-link"><i class="iconfont undefined"></i>
  Css
</a></li><li class="dropdown-item"><!----> <a href="/categories/JavaScript/" class="nav-link"><i class="iconfont undefined"></i>
  JavaScript
</a></li><li class="dropdown-item"><!----> <a href="/categories/闲言碎语/" class="nav-link"><i class="iconfont undefined"></i>
  闲言碎语
</a></li></ul></div></div><div class="nav-item"><a href="/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  标签
</a></div><div class="nav-item"><a href="/tools/" class="nav-link"><i class="iconfont reco-document"></i>
  收藏
</a></div><div class="nav-item"><a href="/photo/" class="nav-link"><i class="iconfont reco-douyin"></i>
  画廊
</a></div><div class="nav-item"><a href="/friends/" class="nav-link"><i class="iconfont reco-friend"></i>
  关于
</a></div><div class="nav-item"><a href="/timeLine/" class="nav-link"><i class="iconfont reco-date"></i>
  时间轴
</a></div> <!----></nav>  <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>Docker安装Oracle 12c</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/views/docker/dockerOracle12c.html#oracle简介" class="sidebar-link">Oracle简介</a><ul class="sidebar-sub-headers"></ul></li><li><a href="/views/docker/dockerOracle12c.html#docker下载oracle12c" class="sidebar-link">Docker下载oracle12c</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/views/docker/dockerOracle12c.html#查找oracle镜像" class="sidebar-link">查找oracle镜像</a></li><li class="sidebar-sub-header"><a href="/views/docker/dockerOracle12c.html#" class="sidebar-link"></a></li><li class="sidebar-sub-header"><a href="/views/docker/dockerOracle12c.html#查看已安装镜像" class="sidebar-link">查看已安装镜像</a></li><li class="sidebar-sub-header"><a href="/views/docker/dockerOracle12c.html#启动oracle数据库" class="sidebar-link">启动Oracle数据库</a></li><li class="sidebar-sub-header"><a href="/views/docker/dockerOracle12c.html#查看日志" class="sidebar-link">查看日志</a></li><li class="sidebar-sub-header"><a href="/views/docker/dockerOracle12c.html#进入oracle容器" class="sidebar-link">进入oracle容器</a></li></ul></li><li><a href="/views/docker/dockerOracle12c.html#连接oracle数据库" class="sidebar-link">连接Oracle数据库</a><ul class="sidebar-sub-headers"></ul></li><li><a href="/views/docker/dockerOracle12c.html#创建用户一般分四步" class="sidebar-link">创建用户一般分四步：</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/views/docker/dockerOracle12c.html#创建表空间" class="sidebar-link">创建表空间</a></li><li class="sidebar-sub-header"><a href="/views/docker/dockerOracle12c.html#新建用户" class="sidebar-link">新建用户</a></li><li class="sidebar-sub-header"><a href="/views/docker/dockerOracle12c.html#赋予用户权限" class="sidebar-link">赋予用户权限</a></li></ul></li><li><a href="/views/docker/dockerOracle12c.html#oracle导入dmp文件" class="sidebar-link">Oracle导入dmp文件</a><ul class="sidebar-sub-headers"></ul></li></ul></section></li></ul> </aside> <div class="password-shadow password-wrapper-in" style="display:none;" data-v-071f7da2 data-v-e3b9d544><h3 class="title" style="display:none;" data-v-071f7da2 data-v-071f7da2>Docker安装Oracle 12c</h3> <!----> <label id="box" class="inputBox" style="display:none;" data-v-071f7da2 data-v-071f7da2><input type="password" value="" data-v-071f7da2> <span data-v-071f7da2>Konck! Knock!</span> <button data-v-071f7da2>OK</button></label> <div class="footer" style="display:none;" data-v-071f7da2 data-v-071f7da2><span data-v-071f7da2><i class="iconfont reco-theme" data-v-071f7da2></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-071f7da2>vuePress-theme-reco</a></span> <span data-v-071f7da2><i class="iconfont reco-other" data-v-071f7da2></i> <a data-v-071f7da2>yykrlc</a></span> <span data-v-071f7da2><i class="iconfont reco-copyright" data-v-071f7da2></i> <a data-v-071f7da2>2021</a></span></div></div> <div data-v-e3b9d544><main class="page"><!----> <div class="page-title" style="display:none;"><h1>Docker安装Oracle 12c</h1> <hr> <div data-v-3cf1d7fb><i class="iconfont reco-account" data-v-3cf1d7fb><span data-v-3cf1d7fb>yykrlc</span></i> <i class="iconfont reco-date" data-v-3cf1d7fb><span data-v-3cf1d7fb>2020-03-26</span></i> <i class="iconfont reco-eye" data-v-3cf1d7fb><span id="/views/docker/dockerOracle12c.html" data-flag-title="Your Article Title" class="leancloud-visitors" data-v-3cf1d7fb><a class="leancloud-visitors-count" style="font-size:.9rem;font-weight:normal;color:#999;"></a></span></i> <i class="iconfont reco-tag tags" data-v-3cf1d7fb><span class="tag-item" data-v-3cf1d7fb>
      docker
    </span><span class="tag-item" data-v-3cf1d7fb>
      linux
    </span><span class="tag-item" data-v-3cf1d7fb>
      oracle
    </span></i></div></div> <div class="theme-reco-content content__default" style="display:none;"><h2 id="oracle简介"><a href="#oracle简介" class="header-anchor">#</a> Oracle简介</h2> <blockquote><p>Oracle 12c，全称Oracle Database 12c，是Oracle 11g的升级版，新增了很多新的特性</p></blockquote> <h2 id="docker下载oracle12c"><a href="#docker下载oracle12c" class="header-anchor">#</a> Docker下载oracle12c</h2> <h3 id="查找oracle镜像"><a href="#查找oracle镜像" class="header-anchor">#</a> <strong>查找oracle镜像</strong></h3> <p><code>docker search oracle</code> <img src="https://upload-images.jianshu.io/upload_images/15668934-e26fb9fd1e3e196b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt=""></p> <h3 id=""><a href="#" class="header-anchor">#</a></h3> <p><strong>下载Oracle镜像</strong></p> <blockquote><p>我这里选择<code>truevoly/oracle-12c</code>镜像</p></blockquote> <p><code>docker pull truevoly/oracle-12c</code></p> <h3 id="查看已安装镜像"><a href="#查看已安装镜像" class="header-anchor">#</a> <strong>查看已安装镜像</strong></h3> <p><img src="https://upload-images.jianshu.io/upload_images/15668934-4a73af68fe9e1192.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt=""></p> <h3 id="启动oracle数据库"><a href="#启动oracle数据库" class="header-anchor">#</a> <strong>启动Oracle数据库</strong></h3> <p>启动并暴露<code>8080&amp;1521</code>端口，<code>8080</code>可以登录网页端管理，<code>1521</code>是数据连接端口:
<code>docker run -d -p 8080:8080 -p 1521:1521 truevoly/oracle-12c</code> <img src="https://upload-images.jianshu.io/upload_images/15668934-84e55ca05a9c1fb3.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="">
启动并暴露8080&amp;1521端口，并且挂载宿主机目录 <em><code>/var/oracle/data</code></em> 到oracle服务器*<code>/u01/app/oracle</code>*目录，这样database数据就保存在本地宿主机上：
<code>docker run -d -p 8080:8080 -p 1521:1521 -v /var/oracle/data:u01/app/oracle truevoly/oracle-12c</code></p> <p>启动并定制化DBCA总内存大小，DBCA_TOTAL_MEMORY (in Mb):</p> <h3 id="查看日志"><a href="#查看日志" class="header-anchor">#</a> <strong>查看日志</strong></h3> <p><code>docker logs -f 84d8</code></p> <p><img src="https://upload-images.jianshu.io/upload_images/15668934-d710710456d9e487.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt=""></p> <h3 id="进入oracle容器"><a href="#进入oracle容器" class="header-anchor">#</a> 进入oracle容器</h3> <p>进入镜像的bash对数据库进行进一步的操作</p> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code>docker <span class="token builtin class-name">exec</span> -it 84d8 /bin/bash
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h2 id="连接oracle数据库"><a href="#连接oracle数据库" class="header-anchor">#</a> <strong>连接Oracle数据库</strong></h2> <div class="language-yml line-numbers-mode"><pre class="language-yml"><code><span class="token key atrule">hostname</span><span class="token punctuation">:</span> localhost <span class="token comment">#主机名</span>
<span class="token key atrule">port</span><span class="token punctuation">:</span> <span class="token number">1521</span> <span class="token comment">#端口号</span>
<span class="token key atrule">sid</span><span class="token punctuation">:</span> xe 
<span class="token key atrule">service name</span><span class="token punctuation">:</span> xe <span class="token comment">#服务名</span>
<span class="token key atrule">username</span><span class="token punctuation">:</span> system <span class="token comment">#用户名</span>
<span class="token key atrule">password</span><span class="token punctuation">:</span> oracle <span class="token comment">#密码</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br></div></div><p>使用navicat连接数据库
<img src="https://upload-images.jianshu.io/upload_images/15668934-a0a794f98db2f6d4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt=""></p> <h2 id="创建用户一般分四步"><a href="#创建用户一般分四步" class="header-anchor">#</a> 创建用户一般分四步：</h2> <ul><li>第一步：创建临时表空间（可选）</li> <li>第二步：创建数据表空间</li> <li>第三步：创建用户并制定表空间</li> <li>第四步：给用户授予权限</li></ul> <h3 id="创建表空间"><a href="#创建表空间" class="header-anchor">#</a> 创建表空间</h3> <div class="language-sql line-numbers-mode"><pre class="language-sql"><code><span class="token comment">-- 创建表空间  `BKJ`</span>
<span class="token keyword">CREATE</span> <span class="token keyword">TABLESPACE</span> BKJ 
	TEMPFILE <span class="token string">'/u01/app/oracle/oradata/tablespace/BKJ.DBF'</span> 
	SIZE <span class="token number">32</span>M 
	AUTOEXTEND <span class="token keyword">ON</span> 
	<span class="token keyword">NEXT</span> <span class="token number">32</span> M MASIZE UNLIMITED 
	EXTENT MANAGEMENT <span class="token keyword">LOCAL</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br></div></div><h3 id="新建用户"><a href="#新建用户" class="header-anchor">#</a> 新建用户</h3> <div class="language-sql line-numbers-mode"><pre class="language-sql"><code><span class="token comment">-- 新建用户`TEST`并选择刚创建的表空间 `BKJ`</span>
<span class="token keyword">CREATE</span> <span class="token keyword">USER</span> TEST  
	IDENTIFIED <span class="token keyword">BY</span>  <span class="token number">123456</span>          
		ACCOUNT <span class="token keyword">UNLOCK</span>          
		<span class="token keyword">DEFAULT</span> <span class="token keyword">TABLESPACE</span> BKJ<span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><h3 id="赋予用户权限"><a href="#赋予用户权限" class="header-anchor">#</a> 赋予用户权限</h3> <div class="language-sql line-numbers-mode"><pre class="language-sql"><code><span class="token comment">-- connect,resource,dba权限赋予 test用户</span>
<span class="token keyword">GRANT</span> <span class="token keyword">CONNECT</span><span class="token punctuation">,</span>RESOURCE<span class="token punctuation">,</span>DBA <span class="token keyword">TO</span> TEST<span class="token punctuation">;</span>

<span class="token comment">-- 多权限授权</span>
<span class="token keyword">GRANT</span> <span class="token keyword">CREATE</span> <span class="token keyword">USER</span><span class="token punctuation">,</span><span class="token keyword">DROP</span> <span class="token keyword">USER</span><span class="token punctuation">,</span><span class="token keyword">ALTER</span> <span class="token keyword">USER</span> <span class="token punctuation">,</span><span class="token keyword">CREATE</span> <span class="token keyword">ANY</span> <span class="token keyword">VIEW</span> <span class="token punctuation">,</span>
<span class="token keyword">DROP</span> <span class="token keyword">ANY</span> <span class="token keyword">VIEW</span><span class="token punctuation">,</span>EXP_FULL_DATABASE<span class="token punctuation">,</span>IMP_FULL_DATABASE<span class="token punctuation">,</span>
DBA<span class="token punctuation">,</span><span class="token keyword">CONNECT</span><span class="token punctuation">,</span>RESOURCE<span class="token punctuation">,</span><span class="token keyword">CREATE</span> <span class="token keyword">SESSION</span> <span class="token keyword">TO</span> TEST<span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br></div></div><p>新建用户成功啦&gt;_&lt;</p> <h2 id="oracle导入dmp文件"><a href="#oracle导入dmp文件" class="header-anchor">#</a> Oracle导入dmp文件</h2> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># imp 命令导入</span>

imp test/123456@localhost:1521/XE 
  <span class="token assign-left variable">file</span><span class="token operator">=</span>/u01/app/oracle/test2020.dpm
  <span class="token assign-left variable">log</span><span class="token operator">=</span>/u01/app/oracle/imp.log 
  <span class="token assign-left variable">fromuser</span><span class="token operator">=</span>admin 
  <span class="token assign-left variable">touser</span><span class="token operator">=</span>test 
  <span class="token assign-left variable">constraints</span><span class="token operator">=</span>N <span class="token assign-left variable">ignore</span><span class="token operator">=</span>y

<span class="token comment"># impdp命令导入</span>
impdp test/123456@localhost/XE 
  <span class="token assign-left variable">DIRECTORY</span><span class="token operator">=</span>DATA_PUMP_DIR 
  <span class="token assign-left variable">DUMPFILE</span><span class="token operator">=</span>test2020.dpm 
  <span class="token assign-left variable">REMAP_SCHEMA</span><span class="token operator">=</span>admin:test 
  <span class="token assign-left variable">REMAP_TABLESPACE</span><span class="token operator">=</span>ADMIN_BKJ:BKJ
<span class="token comment"># 说明：</span>
<span class="token comment">#  remap_schema当你从A用户导出的数据，想要导入到B用户中去，就使用这个：</span>
<span class="token comment">#    remap_schema=A:B</span>


<span class="token comment">#  remap_tablespace 与上面类似，数据库对象本来存在于tbs_a表空间，现在你不想放那儿了，想换到tbs_b，就用这个</span>
<span class="token comment">#    remap_tablespace=tbs_a:tbs_b 结果是所有tbs_a中的对象都会建在tbs_b表空间中。</span>

<span class="token comment">#提示：这样做的前提是目标用户B和目标表空间都存在</span>

</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br></div></div><p><strong>参考文章</strong> <a href="http://www.imooc.com/article/268649?block_id=tuijian_wz" target="_blank" rel="noopener noreferrer">Docker快速搭建Oracle12c<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> <a href="https://github.com/MaksymBilenko/docker-oracle-12c" target="_blank" rel="noopener noreferrer">https://github.com/MaksymBilenko/docker-oracle-12c<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p></div> <footer class="page-edit" style="display:none;"><!----> <div class="last-updated"><span class="prefix">Last Updated: </span> <span class="time">6/29/2020, 3:45:05 PM</span></div></footer> <!----> <!----></main> <!----> <div class="comments-wrapper" data-v-e3b9d544><div class="valine-wrapper"><div id="valine"></div></div></div></div></div></div></div></div><div class="global-ui"><div class="back-to-ceiling" style="right:1rem;bottom:6rem;width:2.5rem;height:2.5rem;border-radius:.25rem;line-height:2.5rem;background-color:rgba(231, 234, 241,.5);display:none;" data-v-44bd5a18 data-v-44bd5a18><svg t="1574745035067" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5404" class="icon" data-v-44bd5a18><path d="M526.60727968 10.90185116a27.675 27.675 0 0 0-29.21455937 0c-131.36607665 82.28402758-218.69155461 228.01873535-218.69155402 394.07834331a462.20625001 462.20625001 0 0 0 5.36959153 69.94390903c1.00431239 6.55289093-0.34802892 13.13561351-3.76865779 18.80351572-32.63518765 54.11355614-51.75690182 118.55860487-51.7569018 187.94566865a371.06718723 371.06718723 0 0 0 11.50484808 91.98906777c6.53300375 25.50556257 41.68394495 28.14064038 52.69160883 4.22606766 17.37162448-37.73630017 42.14135425-72.50938081 72.80769204-103.21549295 2.18761121 3.04276886 4.15646224 6.24463696 6.40373557 9.22774369a1871.4375 1871.4375 0 0 0 140.04691725 5.34970492 1866.36093723 1866.36093723 0 0 0 140.04691723-5.34970492c2.24727335-2.98310674 4.21612437-6.18497483 6.3937923-9.2178004 30.66633723 30.70611158 55.4360664 65.4791928 72.80769147 103.21549355 11.00766384 23.91457269 46.15860503 21.27949489 52.69160879-4.22606768a371.15156223 371.15156223 0 0 0 11.514792-91.99901164c0-69.36717486-19.13165746-133.82216804-51.75690182-187.92578088-3.42062944-5.66790279-4.76302748-12.26056868-3.76865837-18.80351632a462.20625001 462.20625001 0 0 0 5.36959269-69.943909c-0.00994388-166.08943902-87.32547796-311.81420293-218.6915546-394.09823051zM605.93803103 357.87693858a93.93749974 93.93749974 0 1 1-187.89594924 6.1e-7 93.93749974 93.93749974 0 0 1 187.89594924-6.1e-7z" p-id="5405" data-v-44bd5a18></path><path d="M429.50777625 765.63860547C429.50777625 803.39355007 466.44236686 1000.39046097 512.00932183 1000.39046097c45.56695499 0 82.4922232-197.00623328 82.5015456-234.7518555 0-37.75494459-36.9345906-68.35043303-82.4922232-68.34111062-45.57627738-0.00932239-82.52019037 30.59548842-82.51086798 68.34111062z" p-id="5406" data-v-44bd5a18></path></svg></div><div data-v-932dc3c2></div></div></div>
    <script src="/assets/js/app.f4a44a18.js" defer></script><script src="/assets/js/3.48232c0c.js" defer></script><script src="/assets/js/1.1ffd113d.js" defer></script><script src="/assets/js/22.f3c7aad6.js" defer></script>
  </body>
</html>
